package com.auxgroup.smarthome.entity;

import org.hibernate.annotations.GenericGenerator;

import javax.persistence.Column;
import javax.persistence.Entity;
import javax.persistence.GeneratedValue;
import javax.persistence.Id;
import javax.persistence.Table;

/**
 * 用户设备关联关系
 * @Author: laiqiuhua.
 * @Date: 2017/7/28 9:43.
 */
@Entity
@Table(name = "user_device")
public class UserDeviceEntity extends AbstractGenericEntity {

    @Id
    @GenericGenerator(name = "uuid2", strategy = "uuid2")
    @GeneratedValue(generator = "uuid2")
    @Column(length = 36, nullable = false)
    private String id;
    private Integer shareType=0; // 分享者类别，默认二维码分享
    @Column(length = 36)
    private String uid; // 被分享者uid

    @Column(length = 20)
    private String username;

    @Column(length = 20)
    private String phone;

    @Column(length = 36, nullable = false)
    private String deviceId;

    @Column(length = 20)
    private String devAlias; // 设备别名

    @Column(length = 20)
    private String userAlias; // 用户别名

    @Column(length = 32, nullable = false)
    private String mac;

    @Column(length = 32)
    private String did;

    @Column(length = 1)
    private Integer userTag; // 用户标签：0：主人，1：家人，2：好友

    @Column(length = 1)
    private Integer shareStatus; // 分享状态： 0:未接受分享，1：已接受分享，2：拒绝分享，3：取消分享

    @Column(length = 36)
    private String shareUid; // 分享者uid

    /**
     * 废弃不用， 直接用{@link #userTag}
     */
    @Deprecated
    @Column(length = 1)
    private Integer controllerType; // 控制类型：0：家人永久控制权, 1：好友8小时控制权

    private Integer duration; // 分享周期：单位（分钟)

    private Long expiredAt; // 过期时间
    @Column(length = 100)
    private String qrBatch; // 二维码分享批次, 用uuid生成

    /**
     * 废弃不用，二维码内容不需要存数据库
     */
    @Deprecated
    @Column(columnDefinition = "text")
    private String qrContent;

    @Column(name = "is_trash")
    private Boolean trash; // 垃圾回收站，逻辑删除 分享内容

    public UserDeviceEntity() {}

    public String getId() {
        return id;
    }

    public void setId(String id) {
        this.id = id;
    }

    public String getUid() {
        return uid;
    }

    public void setUid(String uid) {
        this.uid = uid;
    }

    public String getUsername() {
        return username;
    }

    public void setUsername(String username) {
        this.username = username;
    }

    public String getPhone() {
        return phone;
    }

    public void setPhone(String phone) {
        this.phone = phone;
    }

    public String getDeviceId() {
        return deviceId;
    }

    public void setDeviceId(String deviceId) {
        this.deviceId = deviceId;
    }

    public String getDevAlias() {
        return devAlias;
    }

    public void setDevAlias(String devAlias) {
        this.devAlias = devAlias;
    }

    public String getUserAlias() {
        return userAlias;
    }

    public void setUserAlias(String userAlias) {
        this.userAlias = userAlias;
    }

    public String getMac() {
        return mac;
    }

    public void setMac(String mac) {
        this.mac = mac;
    }

    public String getDid() {
        return did;
    }

    public void setDid(String did) {
        this.did = did;
    }

    public Integer getUserTag() {
        return userTag;
    }

    public void setUserTag(Integer userTag) {
        this.userTag = userTag;
    }

    public Integer getShareStatus() {
        return shareStatus;
    }

    public void setShareStatus(Integer shareStatus) {
        this.shareStatus = shareStatus;
    }

    public String getShareUid() {
        return shareUid;
    }

    public void setShareUid(String shareUid) {
        this.shareUid = shareUid;
    }

    public Integer getControllerType() {
        return controllerType;
    }

    public void setControllerType(Integer controllerType) {
        this.controllerType = controllerType;
    }

    public Integer getDuration() {
        return duration;
    }

    public void setDuration(Integer duration) {
        this.duration = duration;
    }

    public Long getExpiredAt() {
        return expiredAt;
    }

    public void setExpiredAt(Long expiredAt) {
        this.expiredAt = expiredAt;
    }

    public String getQrContent() {
        return qrContent;
    }

    public void setQrContent(String qrContent) {
        this.qrContent = qrContent;
    }

    public Integer getShareType() {
        return shareType;
    }

    public void setShareType(Integer shareType) {
        this.shareType = shareType;
    }

    public String getQrBatch() {
        return qrBatch;
    }

    public void setQrBatch(String qrBatch) {
        this.qrBatch = qrBatch;
    }

    public Boolean getTrash() {
        return trash;
    }

    public void setTrash(Boolean trash) {
        this.trash = trash;
    }

}
